<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    // 1.Symbol.for()
    let s1 = Symbol.for('foo')
    let s2 = Symbol.for('foo')
    console.log(s1 === s2) // true

    // 2.Symbol.keyFor() 查询全局注册:如果没有,就返回undefined
    console.log(Symbol.keyFor(s1))  // foo     字符串
    let s3 = Symbol('foo')
    console.log(Symbol.keyFor(s3))  // undefined


</script>
</body>
</html>